<script setup lang="ts">
import { onMounted, onBeforeUnmount } from 'vue';
import { state } from '../submit-success/state';
import { reLaunch } from '@tarojs/taro';
import StoreRoomEdit from './components/store-room-edit.vue';

onMounted(() => {
  state.from = 'store-room-single';
});
onBeforeUnmount(() => (state.from = ''));
</script>

<template>
  <view class="store-room-single app-page--1">
    <app-navbar title="库房申领" />
    <nut-tabs
      model-value="edit"
      class="store-room-single__tabs"
      @click="
        ({ paneKey }) => {
          if (paneKey === 'record') {
            reLaunch({
              url: '/pages/approve/record/index?from=store_room_single',
            });
          }
        }
      "
    >
      <nut-tab-pane title="发起申请" pane-key="edit" />
      <nut-tab-pane title="申请记录" pane-key="record" />
    </nut-tabs>
    <store-room-edit />
  </view>
</template>
<style lang="scss">
.store-room-single {
  &__tabs {
    .nut-tabs {
      &__content {
        display: none;
      }
    }
  }
}
</style>
